package com.company.nowcoder;


import java.util.*;

public class 神奇的数字 {

    public static void main(String[] args) {
        System.out.println(change("1234"));
    }

    public static String change (String number) {
        // write code here
        if (number == null || number.length() == 0) return number;
        StringBuilder sb = new StringBuilder();
        Stack<Character> stack = new Stack<>();
        char[] chars = number.toCharArray();

        for (char c : chars) {
            if ((c - '0') % 2 == 0) stack.push(c);
        }

        for (char c : chars) {
            if ((c - '0') % 2 == 0) sb.append(stack.pop());
            else sb.append(c);
        }
        return sb.toString();
    }

}
